package com.chaos.payment.service.pay;


import com.chaos.framework.model.dto.result.data.DataResult;
import com.chaos.order.api.dto.pay.request.PayRequest;
import com.chaos.order.api.dto.pay.request.RefundRequest;
import com.chaos.order.api.dto.pay.response.PayResponse;
import com.chaos.order.api.dto.pay.response.RefundResponse;
import org.springframework.transaction.annotation.Transactional;


/**
 * 支付抽象接口
 * @param <PayReq>
 * @param <RefundReq>
 */
public abstract class AbstractPay<PayReq extends PayRequest,RefundReq extends RefundRequest> {

    /**
     * 预支付(包含验签)
     * @param request  请求参数
     * @return PayResponse  返回的信息
     */
    @Transactional(rollbackFor = Exception.class)
    public abstract DataResult<PayResponse> pay(PayRequest request);

    /**
     * 支付结果主动查询
     */
    public abstract DataResult<PayResponse> payQuery(PayRequest request);

    /**
     * 支付取消
     */
    public abstract DataResult<PayResponse> payCancel(PayRequest request);

    /**
     * 退款
     */
    public abstract  DataResult<RefundResponse> refund(RefundReq request);

    /**
     * 退款结果主动查询
     */
    public abstract  DataResult<RefundResponse> refundQuery(RefundReq request);

    /**
     * 验证签名
     */
    public abstract Boolean verifySign(String jsonObject, Integer verifyType);
}
